﻿namespace NTLib.Core.Configuration.Values
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// Contains a simple object
    /// </summary>
    /// <seealso cref="NTLib.Core.Configuration.ConfigValue" />
    [DataContract]
    public class ObjectContainerValue<T> : ConfigValue
    {
        #region Fields

        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectContainerValue" /> class.
        /// </summary>
        public ObjectContainerValue()
            : base(typeof(T).Name)
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectContainerValue{T}"/> class.
        /// </summary>
        /// <param name="configKey">The configuration key.</param>
        public ObjectContainerValue(string configKey) : base(configKey)
        {
        }

        #endregion

        #region Methods

        /// <summary>
        /// Gets or sets the data.
        /// </summary>
        /// <value>
        /// The data.
        /// </value>
        [DataMember(Name = "data")]
        public T Data { get; set; }

        /// <summary>
        /// Gets or sets the key.
        /// </summary>
        /// <value>
        /// The key.
        /// </value>
        [DataMember(Name = "key")]
        public string Key
        {
            get { return this._configKey; }
            set { this._configKey = value; }
        }

        #endregion

    }
}
